package com.anysoft.util.code;

import com.anysoft.util.Factory;
import com.anysoft.util.Pair;
import com.anysoft.util.Settings;
import com.anysoft.util.code.util.RSAUtil;

/**
 * SDACoder的工厂类
 * @author duanyy
 *
 */
public class CoderFactory extends Factory<Coder> {
	public static final String DFT_CODER = "DES3";
	protected static CoderFactory factory = null;

	protected CoderFactory(ClassLoader cl){
		super(cl);
	}

	public static Coder newCoder(String module){
		if (factory == null){
			synchronized (CoderFactory.class) {
				if (factory == null) {
					factory = new CoderFactory(Settings.getClassLoader());
				}
			}
		}
		return factory.newInstance(module);
	}

	@Override
	public String getClassName(String _module) {
		if (_module.indexOf('.') < 0){
			return "com.anysoft.util.code.coder." + _module;
		}
		return _module;
	}
}
